﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace XFSale.Aux
{
    public class BasePage : System.Web.UI.Page
    {
        protected void Page_Error(object sender, EventArgs e)
        {
            AlertError(Server.GetLastError().Message);
            Server.ClearError();
        }

        protected void Redirect(string url)
        {
            Response.Redirect(url);
        }

        protected void AlertError(string msg)
        {
            UpdatePanel upMain = Page.Master.FindControl("upMain") as UpdatePanel;
            ScriptManager.RegisterClientScriptBlock(upMain, GetType(), Page.Request.Path, "alert('" + msg + "');", true);
        }

        protected void AlertBack(string msg)
        {
            UpdatePanel upMain = Page.Master.FindControl("upMain") as UpdatePanel;
            ScriptManager.RegisterClientScriptBlock(upMain, GetType(), Page.Request.Path, "alert('" + msg + "'); history.back();", true);
        }
    }
}
